package ui;

//import game.Launch;

import javax.swing.*;

import java.awt.BorderLayout;
import java.awt.event.*;

// The frame which comes after the Character Editor
// Contains general information such as loading and exiting.
public class GameLauncher {

	JFrame frame;
	public GameLauncher() {
		frame = new JFrame();
		JPanel north = new JPanel();
		JPanel center = new JPanel();
		JPanel south = new JPanel();
		JPanel panel = new JPanel();
		JButton loadMap = new JButton("Load Map");
	//	JButton startGame = new JButton("Start Game");
		JButton ex = new JButton("Exit");
		
		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		north.add(loadMap);
//		center.add(startGame);
		south.add(ex);
		panel.add(north);
		panel.add(center);
		panel.add(south);
		
		loadMap.addActionListener(new loadMapListener());
//		startGame.addActionListener(new startGameListener());
		ex.addActionListener(new exListener());
		
		frame.getContentPane().add(BorderLayout.CENTER, panel);;
		frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
		frame.setSize(200, 200);
		frame.setVisible(true);
	}
	
	class loadMapListener implements ActionListener {
		public void actionPerformed(ActionEvent ev) {
			FileList fil = new FileList();
			frame.setVisible(false);
			frame.dispose();
			
		}
	}
	
//	class startGameListener implements ActionListener {
//		public void actionPerformed(ActionEvent ev) {
			//Launch gm = new Launch();
//		}
//	}
	
	class exListener implements ActionListener {
		public void actionPerformed(ActionEvent ev) {
			frame.dispose();
			int mc = JOptionPane.INFORMATION_MESSAGE;
			String msg = "Exit Game complete";
			JOptionPane.showMessageDialog(null, msg, "Alert", mc);
		}
	}
//	public static void main(String[] args) {
//		GameLauncher gm = new GameLauncher();

//	}

}
